package anni.core.mock.db.domain;


// Generated 2007-7-11 22:14:50 by Hibernate Tools 3.2.0.b9
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


/**
 * Category generated by hbm2java
 */
@Entity
@Table(name = "CATEGORY", schema = "PUBLIC")
public class Category implements java.io.Serializable {
    /** * serial. */
    static final long serialVersionUID = 0L;
    private Long id;
    private Category category;
    private String name;
    private Set<Category> categories = new HashSet<Category>(0);

    public Category() {
    }

    public Category(Category category, String name,
        Set<Category> categories) {
        this.category = category;
        this.name = name;
        this.categories = categories;
    }

    @GenericGenerator(name = "generator", strategy = "increment")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "ID", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PARENT_ID")
    public Category getCategory() {
        return this.category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    @Column(name = "NAME", length = 50)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
    public Set<Category> getCategories() {
        return this.categories;
    }

    public void setCategories(Set<Category> categories) {
        this.categories = categories;
    }
}
